import asyncio
import motor.motor_asyncio

"""
    insert_one()
    insert_many()
"""

client = motor.motor_asyncio.AsyncIOMotorClient('localhost', 27017)
db = client.test
col = db.test_collection

async def do_insert():
    result = await col.insert_many([{"i": i} for i in range(2000)])
    print("inserted %d docs" % (len(result.inserted_ids),))
    
loop = client.get_io_loop()
loop.run_until_complete(do_insert())